#include"graphicsview.h"

GraphicsView::GraphicsView(QWidget*praent):QGraphicsView(praent),
    isFull(false)
{
    setDragMode(QGraphicsView::ScrollHandDrag);
    setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing);
}



void GraphicsView::zoomIn()
{
    scaleby(1.1);
}
void GraphicsView::zooOut()
{
    scaleby(1.0/1.1);
}
void GraphicsView::wheelEvent(QWheelEvent *event)
{
    scaleby(std::pow(4.0/3.0,(-event->delta()/240.0)));
}
void GraphicsView::scaleby(double factor)
{
    scale(factor,factor);
}

void GraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
{
    QGraphicsView::mouseDoubleClickEvent(event);
    if (!isFull) {
        emit sig_max_show();
    } else {
        close();
    }
}

